package com.hubiwei.gmall.realtime.util;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class RedisUtil {
    
    private static JedisPool pool;
    
    
    
    static {
    
        JedisPoolConfig conf = new JedisPoolConfig();
        conf.setMaxTotal(300);
        conf.setMaxIdle(10);
        conf.setMaxWaitMillis(10 * 1000);
        conf.setMinIdle(5);
        conf.setTestOnBorrow(true); // ping
        conf.setTestOnCreate(true);
        conf.setTestOnReturn(true);
    
        pool = new JedisPool(conf, "hadoop162", 6379);
    }
    
    public static Jedis getRedisClient() {
        
        return pool.getResource();
    }
}
